//
//  ViewController.m
//  testswiftsdk
//
//  Created by admin on 2021/2/27.
//

#import "ViewController.h"
#import <CommonCrypto/CommonCrypto.h>
#import <XMPurchase/XMPurchase-Swift.h>
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSString *str = @"123456";
    NSLog(@"%@",[self MD5StringWithString:str]);
    XMManager *m = [XMManager shareManager];
    [m testmd5WithStr:str];
    // Do any additional setup after loading the view.
}
-(NSString *)MD5StringWithString:(NSString *)string
{
    const char *cStr = [string UTF8String];
    unsigned char result[16];
    CC_MD5(cStr, (CC_LONG)strlen(cStr), result);
//    CC_SHA256(cStr, (CC_LONG)strlen(cStr), result);
    NSString *MD5Value = [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
                          result[0], result[1], result[2], result[3],
                          result[4], result[5], result[6], result[7],
                          result[8], result[9], result[10], result[11],
                          result[12], result[13], result[14], result[15]];
    return MD5Value;
    
}

@end
